import React from 'react';
import axios from 'axios';
import { useRef, useState } from 'react';
const Login = () => {
  const [title] = useState('登录')
  const username = useRef()
  const pass = useRef()
  const login = () => {
    console.log(username.current.value);
    axios.post("http://estate.eshareedu.cn/exam/api/teacher/checklogin", {
      username: username.current.value,
      pass: pass.current.value
    }).then(
      response => {
        console.log(response);
      },
      error => {
        console.log(error);
      }
    )
  }
  return (
    <div>
      <div style={{ marginTop: '300px' }}>  
        <div style={{ textAlign: 'center', color: '', fontSize: '30px' }}>{title}</div>
        <div style={{ width: '300px', height: '300px', margin: 'auto' }}>
          <div style={{ margin: 'auto', padding: '20px 30px' }}>
            <div style={{ padding: '10px 10px', borderRadius: '5px' }}>
              <span>账号: </span>
              <input ref={username} type="text"></input>
            </div>
          </div>
          <div style={{ margin: 'auto', padding: '0px 30px' }}>
            <div style={{ padding: '10px 10px', borderRadius: '5px' }}>
              <span>密码: </span>
              <input ref={pass} type="password"></input>
            </div>
          </div>
          <button onClick={login} style={{ width: '80%', margin: '20px 30px' }}>登录</button>
        </div>
      </div>
    </div>
  );
};
export default Login;